package com.ruoyi.diagmanage.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.analysiswarning.domain.AnalyOverview;
import com.ruoyi.analysiswarning.domain.vo.PageVO;
import com.ruoyi.diagmanage.domain.DiaIntelligent;
import com.ruoyi.diagmanage.domain.StateInventory;
import com.ruoyi.diagmanage.domain.StateReport;
import com.ruoyi.diagmanage.mapper.StateReportMapper;
import com.ruoyi.diagmanage.service.StateReportService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class StateReportServiceImpl implements StateReportService {

    @Resource
    private StateReportMapper stateReportMapper;


    @Override
    public List<StateReport> queryReportList(StateReport stateReport) {
        return stateReportMapper.queryReportList(stateReport);
    }

    @Override
    public PageVO<List<StateInventory>>  queryInventoryList(PageVO<StateInventory> stateInventory) {

        PageHelper.startPage(stateInventory.getPageNumber(),stateInventory.getPageSize());
        List<StateInventory> stateInventories = stateReportMapper.queryInventoryList(stateInventory.getData());

        PageInfo<StateInventory> page = new PageInfo<>(stateInventories);

        PageVO<List<StateInventory>> analyOverviewPageVO = new PageVO<>();

        analyOverviewPageVO.setPageNumber(page.getPageNum()).setPageSize(page.getPageSize()).setTotal(page.getTotal()).setData(page.getList());

        return analyOverviewPageVO;
    }


    @Override
    public List<StateInventory> queryInventoryList(StateInventory stateInventory) {
        return stateReportMapper.queryInventoryList(stateInventory);
    }

    @Override
    public List<DiaIntelligent> getSystemByDBId(String dbId) {
        return stateReportMapper.getSystemByDBId(dbId);
    }

    @Override
    public List<Map<String, String>> selectReportQuestion(String reportId) {
        return stateReportMapper.selectReportQuestion(reportId);
    }


}
